<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8" />
		<title>账户余额-{eyou:global name='web_name' /}</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
		<link href="{eyou:global name='web_cmspath'/}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
		{eyou:static file="users/skin/css/basic.css" /}
		{eyou:static file="users/skin/css/eyoucms.css" /}
		<!-- 新样式 2020-11-25 -->
		{eyou:static file="users/skin/css/element/index.css" /}
		{eyou:static file="users/skin/css/e-user.css" /}
		{eyou:include file="users/skin/css/diy_css.htm" /}

		{eyou:static file="/public/static/common/js/jquery.min.js"/}
		{eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
		{eyou:static file="users/skin/js/global.js"/}
	</head>

	<body>
		<!-- 头部 -->
		{eyou:include file="users/users_header.htm" /}
		<!-- 头部结束 -->
        <div class="breadcrumbs">
            <div class="w1226">
                <a href="{eyou:global name='web_cmsurl'/}">首页</a> <span class="sep">/</span> <a href="{eyou:url link='user/Users/index' /}">会员中心</a> <span class="sep">/</span> <span>账户余额</span>
            </div>
        </div>
        <div class="ey-body-bg">
            <div class="ey-body pd0">
                <div class="ey-container w1226">
                    <!-- 侧边 -->
                    {eyou:include file="users/users_left.htm" /}
                    <!-- 侧边结束 -->
        
                    <!-- 中部 -->
                    <div class="ey-con fr">
                        <div class=" xin_mian user-pay-con main-bg">
                            <div class="user-pay-box">
                                <div class="user-info-title">
                                    <h1>账户充值</h1>
                                </div>
                                <form id="postForm" action="{eyou:url link='user/Pay/pay_account_recharge' /}" method="post">
                                    <div class="item-from-row">
                                        <div class="from-row-l">
                                            账户余额 : 
                                        </div>
                                        <div class="from-row-r">
                                            ￥<span class="red">{$users.users_money}</span>元
                                        </div>
                                    </div>
                                    <div class="item-from-row">
                                        <div class="from-row-l">
                                            充值金额 :
                                        </div>
                                        <div class="from-row-r">
                                            <span>￥ <input type="text" class="el-input__inner w100" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9\.]/g,'')" name="money" value="{$money}"> 元</span>
                                        </div>
                                    </div>
                                    <div class="item-from-row" id="div_zhifufangshi" style="min-height: 60px;line-height: 60px; display: none;">
                                        <div class="from-row-l">
                                            支付方式 : 
                                        </div>
                                        <div class="from-row-r">
                                            <!-- 支付API列表，套板请务必将整块代码一起复制，包含隐藏域 -->
                                            <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
                                            {eyou:sppayapilist id='vo'}
                                                {eyou:notempty name="$vo.pay_id"}
                                                    {neq name="$vo.pay_mark" value="Hupijiaopay"}
                                                        {eyou:php}$pay_mark_vars = "users/skin/images/pay_".$vo['pay_mark'].".png";{/eyou:php}
                                                        <div class="pay-type-item {eq name='$key' value='0'} active {/eq}" data-type="zxzf_{$vo.pay_mark}">
                                                            <img src="{eyou:empty name='$vo.pay_img'}{eyou:static file='$pay_mark_vars' /}{eyou:else/}{$vo.pay_img}{/eyou:empty}" alt="{$vo.pay_name}">
                                                            <i class="el-icon-check"></i>
                                                        </div>
                                                    {/neq}
                                                {/eyou:notempty}
                                                {$vo.hidden}
                                            {/eyou:sppayapilist}
                                            <input type="hidden" id="PayID">
                                            <input type="hidden" id="PayMark">
                                            <!-- END -->
            
                                            <script type="text/javascript">
                                                $(function(){
                                                    if ($('#div_zhifufangshi').find('.pay-type-item').length > 0) {
                                                        $('#div_zhifufangshi').show();
                                                    }
                                                });
                                            </script>
                                        </div>
                                    </div>
                                    <div class="el-row mt30 ">
                                        <input type="hidden" name="payment_type" value="zxzf_wechat">
                                        <input type="hidden" name="unified_number" value="{$unified_number}">
                                        <a href="JavaScript:void(0);" id='pay_btn' onclick="pay_money();" class="button2 el-button--primary">
                                            立即支付
                                        </a>
                                    </div>
                                </form>
                       
                    		
                                <div class="ey-con-inside mt30">
                                    
                                    <div>
                                        <div id="finance-list_wrapper" class="el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition" style="width: 100%;padding-bottom: 10px;">
                                            <table class="pay_details" cellspacing="0" id="finance-list" data-table-ajaxurl="" data-table-pagelength="20" data-plugin="selectable"
                                             role="grid" aria-describedby="finance-list_info">
                                                <thead>
                                                    <tr role="row">
                                                        <th style="width: 260px"><div class="cell">订单号</div></th>
                                                        <th style="width: 180px;"><div class="cell">金额</div></th>
                                                        <th style="width: 140px;"><div class="cell">类型</div></th>
                                                        <th style="width: 130px;"><div class="cell">状态</div></th>
                                                        <th style="width: 170px;"><div class="cell">时间</div></th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    {eyou:empty name="list"}
                                                    <tr>
                                                        <td class="border-none" align="center" axis="col0" colspan="50">
                                                            <div class="cell pt50 pb50 tc">
                                                               <span class="mb10"><img id='litpic_img'  src="__PUBLIC__/static/common/images/null-data.png"/></span>
                                                             </div>
                                                        </td>
                                                    </tr>
                                                    {eyou:else/}
                                                    {eyou:volist name="list" id="vo"}
                                                    <tr >
                                                        <td ><div class="cell">{$vo.order_number}</div></td>
                                                        <td><div class="cell red">￥
                                                            {eyou:if condition="in_array($vo.cause_type, [0, 3])"}
                                                                -{$vo.money}
                                                            {eyou:else /}
                                                                +{$vo.money}
                                                            {/eyou:if}
                                                            </div>
                                                        </td>
                                                        <td><div class="cell">{$pay_cause_type_arr[$vo['cause_type']]|default=''}</div></td>
                                                        <td><div class="cell">{$pay_status_arr[$vo['status']]|default=''}</div></td>
                                                        <td><div class="cell">{$vo.add_time|date='Y.m.d H:i',###}</div></td>
                                                    </tr>
                                                    {/eyou:volist}
                                                    {/eyou:empty}
                                                </tbody>
                                            </table>
                                        </div>
                                        {$page}
                                        {eyou:if condition="!empty($pager->totalRows)"}
                                        <div class="fytotal">共{$pager->totalRows}条记录</div>
                                        {/eyou:if}
                                    </div>
                        
                                </div>
                            </div>
                    	</div>
                    </div>
                    <!-- 中部结束 -->
                </div>
            </div>

            <input type="hidden" id="unified_id">
            <input type="hidden" id="unified_number">
            <input type="hidden" id="transaction_type">
            <input type="hidden" id="referurl" value="{:url('user/Pay/pay_consumer_details')}">
        </div>

        <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
        <script type="text/javascript">
            $(document).keydown(function(event){
                if(event.keyCode ==13){
                    pay_money();
                    return false;
                }
            });
            
            $(function(){
                $('input[name=money]').focus();
                // 默认支付方式
                var default_payment_type = $('#div_zhifufangshi .pay-type-item.active').attr('data-type');
                $('input[name=payment_type]').val(default_payment_type);
                // 支付类型选择
                $('#div_zhifufangshi .pay-type-item').click(function(){
                    $(this).siblings().removeClass('active').end().addClass('active');
                    $('input[name=payment_type]').val($(this).data('type'));
                });
            });

            function pay_money(){
                var money = $('input[name=money]');
                if($.trim(money.val()) == ''){
                    layer.msg('充值金额不能为空！', {icon: 5, time: 1000});
                    money.focus();
                    return false;
                } else if(isNaN($.trim(money.val()))){
                    layer.msg('请输入正确的充值金额！', {icon: 5, time: 1000});
                    money.focus();
                    return false;
                }

                if($('input[name=payment_type]').val() == ''){
                    layer.msg('请选择支付方式！', {icon: 5, time: 1000});
                    return false;
                }

                layer_loading('正在处理');
                $.ajax({
                    url: "{:url('user/Pay/pay_account_recharge', ['version'=>'v3', '_ajax'=>1])}",
                    data: $('#postForm').serialize(),
                    type:'post',
                    dataType:'json',
                    success:function(res){
                        if (res.code == 1) {
                            if (0 == res.data.is_gourl) {
                                layer.closeAll();
                                $('#unified_id').val(res.data.unified_id);
                                $('#unified_number').val(res.data.unified_number);
                                $('#transaction_type').val(res.data.transaction_type);
                            } else {
                                SelectPayMethod_2(res.data.pay_id, res.data.pay_mark, res.data.unified_id, res.data.unified_number, res.data.transaction_type);
                            }
                        } else {
                            layer.closeAll();
                            showErrorAlert(res.msg, 0);
                        }
                    },
                    error : function(e) {
                        layer.closeAll();
                        showErrorAlert(e.responseText);
                    }
                });
            }
        </script>
		{eyou:include file="users/users_footer.htm" /}
